#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------


Func make_calculate($make_forecast = True)
	Local $map = $last_map
	Local $award = create_award()
	Local $step = calc_full($map, $award, False,$make_forecast)
	set_label("step: " & $step & @CRLF & award_to_str($award) & @CRLF)
	show_map($map)
EndFunc

Func make_calculate_log($make_forecast = True)
	Local $map = $last_map
	Local $award = create_award()
	Local $log = "begin log" & @CRLF
	Local $step = calc_full($map, $award, $log,$make_forecast)
	set_label("step: " & $step & @CRLF & award_to_str($award) & @CRLF)
	show_map($map)
	store_log($log)
EndFunc

Func make_random_field()
	Local $map[$row_length][$col_length]
	Local $min = 1
	Local $max = UBound($field,1) - 1
	For $r = 0 To $row_length - 1
		For $c = 0 To $col_length - 1
			$map[$r][$c] = Random($min,$max,1)
		Next
	Next
	Return $map
EndFunc

Func random_field()
	Local $map = make_random_field()
	show_map($map)
EndFunc

Func random_field_clear()
	Local $map
	Local $log = False
	Do
		Local $award = create_award()
		$map = make_random_field()
	Until count_map($map, $award, False) = 0
	show_map($map)
EndFunc


Func load_map()
	Local $file = FileOpenDialog("open",$log_path,"Map (*.txt)", 1)
	If @error = 0 Then
		load_file($file)
		set_label("load file :" & $file & " ok")
	Else
		set_label("no file")
	EndIf
EndFunc

Global $cnt_capture = 1000
Func read_field()
	Local $map[$row_length][$col_length]
	;Local $cnt = capture_game($map,"capture-" & $cnt_capture & ".jpg")
	;$cnt_capture += 1
	Local $cnt = capture_game($map)
	show_map($map)
	If $cnt > 0 Then
		Local $log = map_to_str($last_map) & @CRLF
		gen_advice($log)
	EndIf
EndFunc
